package com.newtouch.bxzs.enterprise.controller;

import com.newtouch.bxzs.common.base.response.BaseResponse;
import com.newtouch.bxzs.common.base.response.RespGenerator;
import com.newtouch.bxzs.enterprise.config.MyLog;
import com.newtouch.bxzs.enterprise.model.bo.AcceptionCustomerRecordBO;
import com.newtouch.bxzs.enterprise.model.vo.AcceptionCustomerVO;
import com.newtouch.bxzs.enterprise.model.vo.CustomerCndVO;
import com.newtouch.bxzs.enterprise.model.vo.GoBackCustomerVO;
import com.newtouch.bxzs.enterprise.service.AcceptionCustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 客户接收Controller
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/1/13 16:00</td>
 * <td>Amour</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author Amour
 * @version 1.0.0
 * @since 1.0.0
 */
@Api(tags = "客户接收记录")
@RestController
@RequestMapping("acception")
@SuppressWarnings("unchecked")
public class AcceptionCustomerController{

    private static final Log logger = LogFactory.getLog(AcceptionCustomerController.class);

    @Autowired
    private AcceptionCustomerService acceptionCustomerService;



    @ApiOperation("查询客户接收列表")
    @PostMapping("/getReceiveList")
    @MyLog(systemFunctionName = "客户接收记录",systemFunctionUrl = "/acception/getReceiveList",userOperationType = 4,userOperationSummary = "查询客户接收列表")
    public BaseResponse<AcceptionCustomerRecordBO> getReceiveList(@RequestBody CustomerCndVO customerCndVO){
        logger.info("AcceptionCustomerController.getReceiveList:查询客户接收列表");
        return RespGenerator.returnOK(acceptionCustomerService.getReceiveList(customerCndVO));
    }

    @ApiOperation("接收客户")
    @PostMapping("/receiveCustomer")
    @MyLog(systemFunctionName = "客户接收记录",systemFunctionUrl = "/acception/receiveCustomer",userOperationType = 2,userOperationSummary = "接收客户")
    public BaseResponse<String> receiveCustomer(@RequestBody AcceptionCustomerVO acceptionCustomerVO){
        logger.info("AcceptionCustomerController.receiveCustomer:接收客户");
        return  RespGenerator.returnOK(acceptionCustomerService.receiveCustomer(acceptionCustomerVO));
    }

    @ApiOperation("一键出单")
    @GetMapping("/issueAnOrder")
    @MyLog(systemFunctionName = "客户接收记录",systemFunctionUrl = "/acception/issueAnOrder",userOperationType = 2,userOperationSummary = "一键出单")
    @ApiImplicitParam(name = "policyType", value = "保单通知类型1-投保2-退保3-退保申请4-续期5满期6-一键出单", dataType = "String", required = true)
    public BaseResponse<String> issueAnOrder(@RequestParam("policyType")String policyType){
        logger.info("AcceptionCustomerController.receiveCustomer:接收客户");
        return RespGenerator.returnOK(acceptionCustomerService.issueAnOrder(policyType));
    }

    @ApiOperation("一键办理-分享")
    @GetMapping("/handleShare")
    @MyLog(systemFunctionName = "客户接收记录",systemFunctionUrl = "/acception/handleShare",userOperationType = 2,userOperationSummary = "一键办理-分享")
    public BaseResponse<List<Map<String,String>>> handleShare(){
        logger.info("AcceptionCustomerController.receiveCustomer:接收客户");
        return RespGenerator.returnOK(acceptionCustomerService.handleShare());
    }

    @ApiOperation("一键办理-跳转")
    @GetMapping("/handleJump")
    @MyLog(systemFunctionName = "客户接收记录",systemFunctionUrl = "/acception/handleJump",userOperationType = 2,userOperationSummary = "一键办理-跳转")
    public BaseResponse<List<Map<String,String>>> handleJump(){
        logger.info("AcceptionCustomerController.receiveCustomer:接收客户");
        return RespGenerator.returnOK(acceptionCustomerService.handleJump());
    }

    @ApiOperation("客户退回")
    @PostMapping("/goBackCustomer")
    @MyLog(systemFunctionName = "客户接收记录",systemFunctionUrl = "/acception/goBackCustomer",userOperationType = 2,userOperationSummary = "客户退回")
    public BaseResponse<Boolean> goBackCustomer(@RequestBody GoBackCustomerVO goBackCustomer){
        logger.info("AcceptionCustomerController.receiveCustomer:接收客户");
        return RespGenerator.returnOK(acceptionCustomerService.goBackCustomer(goBackCustomer));
    }
}
